package com.tliaswebmanagement.mapper;

import com.tliaswebmanagement.pojo.Dept;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface DeptMapper {
    /**
     * 查询所有部门
     *
     * @return
     */
    @Select("select * from dept")
    List<Dept> list();

    /**
     * 根据id删除部门
     *
     * @param id
     */
    @Delete("delete from dept where id=#{id}")
    void detele(Integer id);

    /**
     * 添加部门
     * @param dept
     */
    @Insert("insert into dept(id,name,create_time,update_time) values (null,#{name},now(),now())")
    void add(Dept dept);

    /**
     * 查询id
     * @param id
     * @return
     */
@Select("select * from dept where id=#{id}")
    Dept getById(Integer id);
@Update("update dept set name=#{name} , update_time=#{updateTime} where id=#{id} ")
    void update(Dept dept);
}
